﻿using System;
using System.Collections;

namespace Segmentation.Business.Criterions
{
    public class CriterionCollection : IEnumerable
    {
        #region Fields

        private Criterion[] collection;

        #endregion Fields

        #region Constructors

        public CriterionCollection()
        {
            this.collection = new Criterion[] { new NoiseproofFeature(), new Quality(), new Effectiveness() };
        }

        #endregion Constructors

        #region Properties

        public Criterion this[int index]
        {
            get
            {
                return this.collection[index];
            }
        }

        public int Count
        {
            get
            {
                return this.collection.Length;
            }
        }

        #endregion Properties

        #region Methods

        public void Calculate(byte[,] mapIdeal, byte[,] mapCalculated)
        {
            foreach (Criterion criterion in this.collection)
            {
                criterion.CalculateCriterion(mapIdeal, mapCalculated);
            }
        }

        #endregion Methods

        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.collection.GetEnumerator();
        }

        #endregion
    }
}
